package com.jt.sys.controller;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jt.common.exception.ServiceException;
import com.jt.common.vo.JsonResult;
import com.jt.sys.service.SysLogService;
import com.jt.sys.service.SysUserService;

@Controller
@RequestMapping("/")
public class SysLoginController {
	@Autowired
SysUserService sysUserService;
	@RequestMapping("doLoginUI")
	public String doLoginUI(){
		return "login";
	}
	
	/**
	 * 执行登录操作：身份认证（验证用户是否为合法用户）
	 * @param username
	 * @param password
	 * @return
	 */
	
	@RequestMapping("doLogin")
	@ResponseBody
	public JsonResult doLogin(String username,//身份信息
			String password){//凭证信息
		//System.out.println(4564);
		sysUserService.login(username, password);
		//System.out.println(sysUserService+"----------------dddddddddddddddddddddddddd");
//		1获取Subject对象
		
		return new JsonResult("login ok");
	}
}
